#ifndef SOCKETSERVER_H
#define SOCKETSERVER_H

#include "socketclient.h"

#include <QLocalServer>
#include <QObject>
#include <command.h>

class SocketServer : public QObject
{
    Q_OBJECT
public:
    SocketServer(QString connect_name);
    virtual ~SocketServer();
    bool startListen();
    void close();

private:
    QString m_connect_name;
    QLocalServer *m_local_server;
    QHash<qintptr,SocketClient*> m_client_hash;


private slots:
    void OnClientDisconnect(qintptr socketDescriptor);
    void OnConnection();
    void OnBackGroundCommand(Command);

signals:
    void DoorNoChanged();
    void QrCodeChanged();
    void PicChanged();
    void IntervalChanged();
};

#endif // SOCKETSERVER_H
